1. Field of the Invention
The present invention relates to a disk storage device for recording data on a disk by a head, and a cache control method, and more particularly to a disk storage device for storing write data in a cache memory according to a write command and notifying the completion of the writing, and a cache control method.
2. Description of the Related Art
Due to the recent demand for data computerized processing, large capacity is demanded for medium storage devices of magnetic disk devices and optical disk devices for storing data. Therefore the track density and recording density of disk medium are increasing more and more. Also high-speed access is demanded. For this, when receiving a normal write command, the storage device stores write data in a cache memory and reports the completion to the host. Then the device writes the write data in the cache memory to a disk medium, that is, a write back is executed.
As FIG. 8 shows, to provide the write cache function, the disk storage device is provided a cache area 120 for storing data and a command management table 110 for storing the management data. When a write command and write data are received from the host, command management information, including the start LBA (Logical Block Address) acquired from the write command, the number of requested sectors, and the storage address in the cache area 120, is created and stored in the command management table 110. And the write data is stored in a specified storage address position of the command management table 110 in the cache area 120.
When no access comes from the host, the write data in this cache area 120 is written to the address (sector position) specified by the command management data in the command management table 110 of the disk 100.
On the other hand, installing a disk storage device on a personal computer and in such portable equipment as a portable music player is becoming popular. Therefore downsizing and lower price are demanded for the disk storage device. This makes it difficult to increase the capacity of the cache area. And this generates limitations in the number of commands and data volumes that can be written back.
As a method for virtually increasing the cache capacity, a method for writing a write command and write data exceeding the capacity of the cache memory in a secondary cache area created on the disk, returning a write completion to the host, and writing back the write data in the cache area, including the secondary cache area, in a specified position on the disk, has been proposed (e.g. Japanese patent Application Laid-Open No. H6-348597).
Another prior art that is proposed is as follows: if the write position of the write data in the cache area 120 is random, as shown in FIG. 8, the seek time and rotation wait time are generated since a plurality of write data W1, W2 and W3 are written. So it is judged whether the received write command is random, and if it is random write data, the data is not stored in the cache area 120, but is written to a save area created on the disk 100. And write completion is returned to the host, then the write data in the cache area 120, including the save area, is written back to specified portion on the disk 100 (e.g. Japanese Patent Application Laid-Open No. H11-232037).
These are methods to virtually expand the write cache area for a write command. Therefore if a command to forcibly write the write data in the write cache area 120 in the disk 100 is issued from the host for the safety of data, the above prior arts cannot be used.
Also if write cache data has already been held in the cache area 120 when such a command, other than a write command, is issued, the received command is executed after all of the write cache data is written to a specified position on the disk 100, as shown in FIG. 8, so the command response to the host device may delay.